var mongoose = require('mongoose'),
    dburl = "mongodb://localhost/imm",
    options = {
        useNewUrlParser: true
    };
mongoose.connect(dburl, options);

var db = {
    connection: mongoose.connection
};

var models = ["directory", "tag", "image", "config"];
models.forEach((model) => {
    db[model] = require('./' + model);
});

module.exports = {
    get: function() {
       return db;
    }
}